Skip to content

update-nixpkgs-inputs: exit non-zero when an input update fails - #599

Merged
dezren39 merged 2 commits into
mainfrom
creator/598-nixpkgs-exit-code
Oct 22, 2026
Merged

dezren39 merged 2 commits into
mainfrom
creator/598-nixpkgs-exit-code

Conversation

@dezren39

@dezren39 dezren39 commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Fixes #598

What

  • scripts/update-nixpkgs-inputs.py: after all per-ref and combined summaries print, exit 1 if any input's nix flake update failed. Success, already-up-to-date, and no-inputs-found runs still exit 0. Discovery, filtering, and summary formatting are unchanged.
  • scripts/update-nixpkgs-inputs.sh: the python3 fallback now triggers only on cannot-execute exits (126/127 — e.g. uv missing for the env -S uv run --script shebang) instead of any non-zero exit, so a genuine update failure is never re-run end-to-end; the wrapper propagates the script's exit status.

Verification (stub nix + minimal flake.lock with one NixOS/nixpkgs input, script copied to a scratch dir)

Pre-fix: summary prints Failed: 1, exit code 0.
Post-fix:

  • failing stub nix: python3 update-nixpkgs-inputs.py exits 1, Failed: 1 still printed, exactly 1 nix invocation.
  • succeeding stub nix: exits 0 (Skipped: 1).
  • via the wrapper with failing nix (no uv on the test box, so the 127 fallback path runs): exit 1, exactly 1 nix invocation — no double update.
  • via the wrapper with the .py made non-executable (126 fallback): exit 1, exactly 1 nix invocation.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

main() counted failed nix flake update runs in the summary but always
exited 0, so && chains, CI and cron callers proceeded as if the inputs
were updated. Exit 1 after all summaries print when any input failed.

The .sh wrapper's || python3 fallback would then have re-run the whole
update after a genuine failure; scope it to the cannot-execute exits
(126/127, e.g. uv missing for the env -S shebang) and propagate the
script's exit status.
@dezren39
dezren39 requested a review from a team as a code owner October 22, 2026 15:45
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d31029b3-b4c8-4845-8458-c95fa53d91f7
📥 Commits

Reviewing files that changed from the base of the PR and between ead788e and 28554d2.

📒 Files selected for processing: 2
  • scripts/update-nixpkgs-inputs.py
  • scripts/update-nixpkgs-inputs.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T15:49:28.941864Z 4daf81e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4daf81e448

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +325 to +326
if failed_total:
sys.exit(1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mirror failure propagation in the package-local updater

When the updater is run from the standalone pkgs/id project, its recipes invoke pkgs/id/scripts/update-nixpkgs-inputs.sh, whose Python and shell implementations remain unchanged. Consequently, a failed nix flake update still returns success there (and the old wrapper can rerun it); this is reproducible with a failing stub nix, where the root wrapper exits 1 but the package-local wrapper exits 0. Apply both changes to the package-local script copies as well.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update-nixpkgs-inputs: failed updates still exit 0 — and the .sh wrapper would re-run the whole update once that is fixed

1 participant